package com.ysstech.finance.entity;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;

import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 财务凭证信息表
 * </p>
 *
 * @author lishuangliang
 * @since 2021-03-10
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("fin_voucher")
public class Voucher extends Model<Voucher> {

    private static final long serialVersionUID = 1L;

    @TableField("ID")
    private String id;

    /**
     * 基金代码
     */
    @TableField("ACCOUNT_ID")
    private String accountId;
    /**
     * 科目编码
     */
    @TableField("SUBJECT_ID")
    private String subjectId;
    /**
     * 凭证编号
     */
    @TableField("NUM")
    private String num;

    /**
     * 顺序
     */
    @TableField("SEQUENCE")
    private Integer sequence;

    /**
     * 摘要
     */
    @TableField("REMARK")
    private String remark;
    /**
     * 币种
     */
    @TableField("CURRENCY")
    private String currency;

    /**
     * 汇率
     */
    @TableField("FRATE")
    private BigDecimal frate;

    /**
     * DR 借 CR 贷
     */
    @TableField("DRANDCR")
    private String drandcr;

    /**
     * 金额
     */
    @TableField("MONEY")
    private BigDecimal money = BigDecimal.ZERO;

    /**
     * 数量
     */
    @TableField("AMOUNT")
    private BigDecimal amount = BigDecimal.ZERO;

    /**
     * 价格
     */
    @TableField("PRICE")
    private BigDecimal price;

    /**
     * 凭证日期
     */
    @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN)
    @TableField("FDATE")
    private LocalDate fdate;

    /**
     * 业务日期
     */
    @JsonFormat(pattern = DatePattern.NORM_DATE_PATTERN)
    @TableField("BIZDATE")
    private LocalDate bizdate;
    /**
     * 凭证来源
     */
    @TableField("SOURCE")
    private String source;
    /**
     * 凭证类型
     */
    @TableField("FTYPE")
    private String ftype;
    /**
     * 状态
     */
    @TableField("STATUS")
    private Integer status;
    /**
     * 证券代码
     */
    @TableField("SECURITIES_CODE")
    private String securitiesCode;
    /**
     * 添加时间
     */
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @TableField("ADD_TIME")
    private LocalDateTime addTime;

    /**
     * 添加用户
     */
    @TableField("ADD_USER")
    private String addUser;

    /**
     * 修改时间
     */
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    @TableField("EDIT_TIME")
    private LocalDateTime editTime;

    /**
     * 修改用户
     */
    @TableField("EDIT_USER")
    private String editUser;
    /**
     * 删除原因
     */
    @TableField("DELETE_REASON")
    private String deleteReason;

    //开始日期
    @TableField(exist = false)
    private String startDate;
    //结束日期
    @TableField(exist = false)
    private String endDate;

    // 统计余额
    @TableField(exist = false)
    private BigDecimal moneyCr = BigDecimal.ZERO;
    @TableField(exist = false)
    private BigDecimal moneyDr = BigDecimal.ZERO;
    @TableField(exist = false)
    private BigDecimal amountCr = BigDecimal.ZERO;
    @TableField(exist = false)
    private BigDecimal amountDr = BigDecimal.ZERO;
    //查询日期
    @TableField(exist = false)
    private String selfdate;
    //基金信息
    @TableField(exist = false)
    private Account account;
    //科目代码
    @TableField(exist = false)
    private String subjectCode;
    //科目名称
    @TableField(exist = false)
    private String subjectName;

    @Override
    protected Serializable pkVal() {
        return null;
    }

}
